﻿using CommunityToolkit.Mvvm.ComponentModel;
using System.Collections.ObjectModel;
using System.Windows;
using TotalApplication.Core;

namespace TotalApplication.viewmodels.Video.Controls
{
    public partial class TagTreeItemVM :BaseViewModel
    {
        #region Properties

        [ObservableProperty]
        private string _name = "";

        [ObservableProperty]
        private ObservableCollection<TagTreeItemVM> _childs = new ObservableCollection<TagTreeItemVM>();

        // Depth 作为计算属性，不需要存储
        public int Depth = 1;

        public double InnerMargin => 2;

        public double Height => 40;

        public double Width => 80;

        public Thickness Thickness => Depth == 0 ? new Thickness(0) : new Thickness(0, Height * (Depth * 2 - 1) - InnerMargin, 0, 0);

        // 父节点引用，用于计算Depth
        public TagTreeItemVM Parent { get; private set; }

        #endregion

        #region Constructor

        /// <summary>
        /// Default constructor
        /// </summary>
        public TagTreeItemVM()
        {

        }

        public TagTreeItemVM(TagTreeItemVM parent)
        {
            Parent = parent;
        }

        #endregion

    }
}
